<template>
	<div class="member-center-main">
		<div class="member-center-menu">
			<div class="info-block">
				<div class="playerid">{{info.name}}</div>
			</div>
			<div class="balance-info">
				<div class="currency">{{$t('indexTitle.title23')}}</div>
				<div class="balance">{{info.money||0}}</div>
			</div>
			<div class="nav-block">
				<div class="item" :class="tab == 0 ? 'active':''" @click="goNextPage('/mine')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title24')}}</div>
				</div>
				<div class="item" :class="tab == 1 ? 'active':''" @click="goNextPage('/vipRebates')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title321')}}</div>
				</div>
				<div class="item" :class="tab == 2 ? 'active':''" @click="goNextPage('/deposit')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title26')}}</div>
				</div>
				<div class="item" :class="tab == 3 ? 'active':''" @click="goNextPage('/withdraw')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title27')}}</div>
				</div>
				<!-- <div class="item" :class="tab == 4 ? 'active':''" @click="goNextPage('/affiliate')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title28')}}</div>
				</div> -->
				<div class="item" :class="tab == 5 ? 'active':''" @click="goNextPage('/mission')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title29')}}</div>
				</div>
				<div class="item" :class="tab == 6 ? 'active':''" @click="goNextPage('/promotions')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title30')}}</div>
				</div>
				<div class="item" :class="tab == 7 ? 'active':''" @click="goNextPage('/game-history')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title31')}}</div>
				</div>
				<div class="item" :class="tab == 8 ? 'active':''" @click="goNextPage('/finan-history')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title32')}}</div>
				</div>
				<div class="item" :class="tab == 9 ? 'active':''" @click="goNextPage('/personalMsg')">
					<img src="../../assets/images/icon.png" alt="" />
					<div class="label">{{$t('indexTitle.title33')}}</div>
				</div>
			</div>
		</div>
		<div class="member-center-content">
			<div class="member-center-profile">
				<div class="title">{{$t('indexTitle.title54')}}</div>
				<div class="tab-content">
					<div class="nrc-tabs-nav">
						<span class="nrc-tabs-tab" :class="tabss == 0 ? 'active':''">{{$t('indexTitle.title55')}}</span>
						<span class="nrc-tabs-tab" :class="tabss == 1 ? 'active':''"
							@click="goNextPage('/changeWithdrawalPassword')">{{$t('indexTitle.title56')}}</span>
					</div>
					<div class="proList">
						<div class="">
							<div class="magBox"
								:class="{focusBox:isShowOne,error:isShowOness,errorww:isShowThreessTow}">
								<div class="input-block" @click="getMsg('0')"><label for="password"
										:class="{inputblocklabel:isShowOne}">{{$t('indexTitle.title57')}}</label>
									<input :type="onetype" :class="{inputblockinput:isShowOne}" v-model="passwordOne"
										:show-password="false" @input='inputjianting(0)' @blur="blurinput('0')">
								</div>
								<div class="action-block">
									<img src="../../assets/images/yanjingkai.png" alt="" @click="shoeEye('0')"
										v-if="isShowOneeye">
									<img src="../../assets/images/jianjingguan.png" alt="" @click="shoeEye('0')"
										v-if="!isShowOneeye">
								</div>
							</div>
							<div class="zhuyiBoxTow" v-if="isShowOness&&!isShowThreessTow">
								<img src="../../assets/images/zhuyitow.png" alt="">
								{{messageTextOne}}
							</div>
							<div class="zhuyiBoxTow" v-if="isShowThreessTow">
								<img src="../../assets/images/zhuyitow.png" alt="">
								{{messageText}}
							</div>
						</div>
						<div class="">
							<div class="magBox "
								:class="{focusBox:isShowTow,error:isShowTowss,errorww:isShowThreessTow}">
								<div class="input-block" @click="getMsg('1')"><label for="password"
										:class="{inputblocklabel:isShowTow}">{{$t('indexTitle.title55')}}</label>
									<input :type="twotype" :class="{inputblockinput:isShowTow}" v-model="passwordTow"
										:show-password="false" @blur="blurinput('1')" @input='inputjianting(1)'>
								</div>
								<div class="action-block">
									<img src="../../assets/images/yanjingkai.png" alt="" @click="shoeEye('1')"
										v-if="isShowToweye">
									<img src="../../assets/images/jianjingguan.png" alt="" @click="shoeEye('1')"
										v-if="!isShowToweye">
								</div>
							</div>
							<div class="zhuyiBoxTow" v-if="isShowTowss&&!isShowThreessTow">
								<img src="../../assets/images/zhuyitow.png" alt="">
								{{messageTextTow}}
							</div>
							<div class="zhuyiBox" v-if="!isShowTowss&&!isShowThreessTow">
								<img src="../../assets/images/zhuyi.png" alt="">
								{{$t('indexTitle.title59')}}
							</div>
							<div class="zhuyiBoxTow" v-if="isShowThreessTow">
								<img src="../../assets/images/zhuyitow.png" alt="">
								{{messageText}}
							</div>
						</div>
						<div class="">
							<div class="magBox"
								:class="{focusBox:isShowThree,error:isShowThreess,errorww:isShowThreessTow}">
								<div class="input-block" @click="getMsg('2')"><label for="password"
										:class="{inputblocklabel:isShowThree}">{{$t('indexTitle.title60')}}</label>
									<input :type="threetype" :class="{inputblockinput:isShowThree}"
										v-model="passwordThree" :show-password="false" @blur="blurinput('2')"
										@input='inputjianting(2)'>
								</div>
								<div class="action-block">
									<img src="../../assets/images/yanjingkai.png" alt="" @click="shoeEye('2')"
										v-if="isShowThreeeye">
									<img src="../../assets/images/jianjingguan.png" alt="" @click="shoeEye('2')"
										v-if="!isShowThreeeye">
								</div>
							</div>
							<div class="zhuyiBoxTow" v-if="isShowThreess&&!isShowThreessTow">
								<img src="../../assets/images/zhuyitow.png" alt="">
								{{messageTextThree}}
							</div>
							<div class="zhuyiBoxTow" v-if="isShowThreessTow">
								<img src="../../assets/images/zhuyitow.png" alt="">
								{{messageText}}
							</div>
						</div>
						<div class="butBox">
							<div class="btnssssTow" @click="goNextPage('/mine')">{{$t('indexTitle.title61')}}</div>
							<div class="btnssss" @click="submit()">{{$t('indexTitle.title62')}}</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<loadingFour :msgText="msgTextTow" :isShowCloseBot="isShowCloseBot" v-if="isShowLoadingTeow"
			@closeGuanbiTow="closeGuanbi"></loadingFour>
	</div>
</template>

<script>
	import {
		resetloginpassword,
		userinfo
	} from "../../utils/api.js"
	import loadingFour from '../../components/loadingFour.vue';
	export default {
		components: {
			loadingFour
		},
		data() {
			return {
				close: true,
				isShowOne: false,
				isShowTow: false,
				isShowThree: false,
				isShowOness: false,
				isShowTowss: false,
				isShowThreess: false,
				isShowOneeye: false,
				isShowToweye: false,
				isShowThreeeye: false,
				threetype: 'password',
				twotype: 'password',
				onetype: 'password',
				passwordOne: "",
				passwordTow: "",
				passwordThree: "",
				tabss: 0,
				tab: 0,
				info: [],

				isShowThreessTow: false,
				messageText: "",
				messageTextOne: this.$t('indexTitle.title58'),
				messageTextTow: this.$t('indexTitle.title58'),
				messageTextThree: this.$t('indexTitle.title58'),
				msgTextTow: "",
				isShowLoadingTeow: false,
				isShowCloseBot: false,
			}
		},
		created() {},
		mounted() {
			this.info = JSON.parse(localStorage.getItem('userInfo'))
			// this.getuserinfo()
		},

		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			getuserinfo() {
				userinfo().then((res) => {
					if (res.status.errorCode == 0) {
						this.info = res.data
					} else if (res.status.errorCode == 401) {
						this.$emit('getTokenNum', false)
						console.log('401')
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = false;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			goNextPage(page) {
				this.$router.push(page)
			},
			getMsg(num) {
				if (num == 0) {
					this.isShowOne = !this.isShowOne;
				}
				if (num == 1) {
					this.isShowTow = !this.isShowTow;
				}
				if (num == 2) {
					this.isShowThree = !this.isShowThree;
				}
			},
			inputjianting(num) {
				if (num == 0) {
					if (!this.passwordOne) {
						this.isShowOness = true;
						this.messageTextOne = this.$t('indexTitle.title58');
						this.isShowOne = !this.isShowOne;
					} else {
						this.isShowOness = false;
						this.isShowThreessTow = false;
						this.messageText = '';
					}
				}
				if (num == 1) {
					if (!this.passwordTow) {
						this.isShowTowss = true;
						this.messageTextTow = this.$t('indexTitle.title58');
						this.isShowTow = !this.isShowTow;
					} else {
						this.isShowTowss = false;
						this.isShowThreessTow = false;
						this.messageText = '';
					}
				}
				if (num == 2) {
					if (!this.passwordThree) {
						this.isShowThreess = true;
						this.messageTextThree = this.$t('indexTitle.title58');
						this.isShowThree = !this.isShowThree;
					} else {
						this.isShowThreess = false;
						this.isShowThreessTow = false;
						this.messageText = '';
					}
				}
			},
			blurinput(num) {
				if (num == 0) {
					if (!this.passwordOne) {
						this.isShowOness = true;
						this.messageTextOne = this.$t('indexTitle.title58');
						this.isShowOne = !this.isShowOne;
					} else {
						this.isShowOness = false;
					}
				}
				if (num == 1) {
					if (!this.passwordTow) {
						this.isShowTowss = true;
						this.messageTextTow = this.$t('indexTitle.title58');
						this.isShowTow = !this.isShowTow;
					} else {
						this.isShowTowss = false;
					}
				}
				if (num == 2) {
					if (!this.passwordThree) {
						this.isShowThreess = true;
						this.messageTextThree = this.$t('indexTitle.title58');
						this.isShowThree = !this.isShowThree;
					} else {
						this.isShowThreess = false;
					}
				}
			},
			shoeEye(num) {
				if (num == 0) {
					this.isShowOneeye = !this.isShowOneeye;
					if (this.onetype == 'text') {
						this.onetype = 'password'
					} else {
						this.onetype = 'text'
					}
				}
				if (num == 1) {
					this.isShowToweye = !this.isShowToweye;
					if (this.twotype == 'text') {
						this.twotype = 'password'
					} else {
						this.twotype = 'text'
					}
				}
				if (num == 2) {
					this.isShowThreeeye = !this.isShowThreeeye;
					if (this.threetype == 'text') {
						this.threetype = 'password'
					} else {
						this.threetype = 'text'
					}
				}
			},
			goBack() {
				this.$router.go(-1)
			},

			submit() {
				let that = this;
				this.isShowOness = false;
				this.isShowTowss = false;
				this.isShowThreess = false;
				if (this.passwordOne == '') {
					this.isShowOness = true;
					this.messageTextOne = this.$t('indexTitle.title63');
					// this.$message.error(this.$t('indexTitle.title63'));
					return false
				}
				if (this.passwordTow == '') {
					this.isShowTowss = true;
					this.messageTextTow = this.$t('indexTitle.title64');
					// this.$message.error(this.$t('indexTitle.title64'));
					return false
				}
				if (this.passwordThree != this.passwordTow) {
					this.isShowThreess = true;
					this.messageTextThree = this.$t('indexTitle.title65');
					// this.$message.error(this.$t('indexTitle.title65'));
					return false
				}
				let data = {
					old_password: this.passwordOne,
					password: this.passwordTow,
					password_confirmation: this.passwordThree
				}
				resetloginpassword(data).then((res) => {
					if (res.status.errorCode == 0) {
						// this.$message.success(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'success'
						// });
						setTimeout(function() {
							that.$router.go(-1)
						}, 1000)
					} else {
						this.isShowThreessTow = true;
						this.messageText = res.status.msg || this.$t('indexTitle.title66');
						// this.$message.error(res.status.msg || this.$t('indexTitle.title66'));
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
	}

	.proList {
		width: 100%;
		padding: 15px 0px 0;
		box-sizing: border-box;
	}

	.magBox {
		border-radius: 5px;
		box-sizing: border-box;
		display: flex;
		height: 54px;
		justify-content: space-around;
		padding: 0 15px;
		background-color: #fbfbfb;
		border: 1px solid #e9e9e9;
		color: #777;
		margin-top: 10px;
		font-weight: 300;
	}

	.input-block {
		box-sizing: border-box;
		position: relative;
		width: 100%;
	}

	.input-block label {
		color: #a0a3a5;
		font-size: 14px;
		line-height: 1.29;
		pointer-events: none;
		position: absolute;
		top: 18px;
		transition: .2s;
		font-weight: 300;
		padding-left: 12px;
	}

	.input-block label:before {
		bottom: 0;
		color: #e94951;
		content: "*";
		font-size: 10px;
		left: 0;
		margin: auto;
		position: absolute;
		top: 4px;
	}

	.inputblocklabel {
		font-size: 10px !important;
		top: 8px !important;
	}

	.input-block input {
		background-color: transparent;
		color: #545658;
		border: none !important;
		box-sizing: border-box;
		height: 100%;
		position: absolute;
		top: 0;
		transition: .2s;
		width: 100%;
		outline: medium;
		padding: 0;
		font-family: sans-serif;
		font-size: 100%;
		line-height: 1.15;
		margin: 0;
	}

	.input-block input:focus {
		height: 28px;
		box-shadow: none;
		top: 24px;
	}

	.inputblockinput {
		height: 28px !important;
		box-shadow: none !important;
		top: 24px !important;
	}

	.focusBox {
		border: 1px solid #5235ff;
		background-color: #fff;
		border-color: rgba(114, 64, 255, .5);
		box-shadow: 0 0 0 2px rgba(114, 64, 255, .1);
	}

	.action-block {
		display: flex;
		justify-content: flex-end;
		width: 15%;
		align-items: center;
	}

	.action-block img {
		width: 20px;
		height: 20px;
	}

	.zhuyiBox img {
		width: 15px;
		height: 15px;
		margin-right: 5px;
	}

	.zhuyiBox {
		display: flex;
		font-size: 12px;
		margin: 5px 0 10px;
		color: #86898c;
		font-weight: 300;
	}


	.zhuyiBoxTow img {
		width: 15px;
		height: 15px;
		margin-right: 5px;
	}

	.zhuyiBoxTow {
		display: flex;
		font-size: 12px;
		margin: 5px 0 10px;
		color: #e94951;
		font-weight: 300;
	}

	.butBox {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.btnssssTow {
		margin-top: 20px;
		background-color: #aaaaaa;
		border: none;
		border-radius: 5px;
		color: #fff;
		cursor: pointer;
		font-size: 16px;
		font-stretch: normal;
		font-style: normal;
		font-weight: 300;
		height: 44px;
		width: 48%;
		text-align: center;
		line-height: 44px;
	}

	.btnssss {
		margin-top: 20px;
		background-color: #7240ff;
		border: none;
		border-radius: 5px;
		color: #fff;
		cursor: pointer;
		font-size: 16px;
		font-stretch: normal;
		font-style: normal;
		font-weight: 300;
		height: 44px;
		width: 48%;
		text-align: center;
		line-height: 44px;
	}

	.error {
		border: 1px solid #e94951;
		color: #e94951;
	}

	.errorww {
		border: 1px solid #e94951;
	}


	.member-center-main {
		color: #545658;
		display: flex;
		justify-content: center;
		margin: 0 auto;
		max-width: 1280px;
		padding: 20px 0;
		width: 100%;
	}

	.member-center-menu {
		overflow: hidden;
		width: 220px;
		margin-top: 10px;
	}

	.info-block {
		align-items: center;
		border-bottom: 1px solid #e9e9e9;
		display: flex;
		padding: 30px 15px 15px;
	}

	.playerid {
		font-size: 22px;
		font-weight: 600;
		word-break: break-all;
	}

	.balance-info {
		align-items: flex-end;
		border-bottom: 1px solid #e9e9e9;
		display: flex;
		justify-content: space-between;
		padding: 15px;
	}

	.currency {
		padding-right: 8px;
	}

	.balance {
		font-size: 18px;
		font-weight: 500;
	}

	.nav-block {
		align-items: center;
		display: flex;
		flex-direction: column;
	}

	.item {
		align-items: center;
		box-sizing: border-box;
		color: #939698;
		cursor: pointer;
		display: flex;
		height: 60px;
		line-height: 1.4;
		padding: 0 15px;
		position: relative;
		transition: .3s ease;
		width: 100%;
	}

	.item.active {
		color: #5235ff;
	}

	.item:hover {
		color: #5235ff;
	}

	.item img {
		width: 28px;
		height: 28px;
		margin-right: 12px;
	}

	.item .label {
		font-size: 16px;
		font-weight: 500;
		line-height: 1.2;
	}

	.member-center-content {
		background: #f9f9f9;
		border-radius: 10px;
		margin-top: 10px;
		box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .15);
		display: flex;
		justify-content: space-between;
		min-height: 700px;
		overflow: hidden;
		position: relative;
		width: calc(100% - 220px);
	}

	.member-center-profile {
		padding: 24px;
		width: 50%;
		position: relative;
	}

	.title {
		color: #545658;
		margin-bottom: 25px;
		font-size: 19px;
		font-weight: 600;
		line-height: 24px;
	}

	.nrc-tabs-nav {
		border: 0;
		align-items: center;
		display: flex;
		justify-content: flex-start;
	}

	.nrc-tabs-tab {
		flex: 1;
		font-weight: 500;
		height: 40px;
		padding: 0 !important;
		margin-right: 8px;
		align-items: center;
		border: 1px solid #e9e9e9;
		border-radius: 50px;
		display: flex;
		font-size: 14px;
		justify-content: center;
		line-height: 20px;
		color: #666;
		cursor: pointer;
		position: relative;
	}

	.nrc-tabs-tab:last-child {
		margin-right: 0;
	}

	.nrc-tabs-tab.active {
		color: #5235ff;
	}

	.setting-btn {
		align-items: center;
		background: #5235ff;
		border-radius: 5px;
		color: #fff;
		cursor: pointer;
		display: flex;
		font-size: 16px;
		font-weight: 500;
		justify-content: center;
		margin: 24px 0;
		padding: 12px 0;
		width: 100%;
	}

	table {
		color: #545658;
		font-size: 15px;
		width: 100%;
	}

	td {
		border-bottom: 1px solid #ececec;
		padding: 15px;
	}

	table .label {
		color: #939698;
	}

	.value-wrap {
		align-items: center;
		display: flex;
	}

	.promo-ads-title {
		display: flex;
		justify-content: space-between;
		margin-bottom: 10px;
	}

	.el-button {
		border-radius: 5px;
		height: 29px;
		padding: 5px 20px;
		background-color: #5235ff;
		border: 0;
		color: #fff;
		cursor: pointer;
		font-size: 16px;
	}

	.nodata {
		height: 700px;
		overflow: auto;
	}

	.no-data {
		align-items: center;
		color: #545658;
		display: flex;
		flex-direction: column;
		margin-top: 150px;
	}

	.no-data img {
		width: 50%;
	}
</style>